#include <QtOpenGL>
#include "plano.h"

Plano::Plano(const QVector3D& center, QObject *parent):
    Object3D(center, parent)
{

}

void Plano::drawGeometry(void)const
{

    float v[3*4] = {  -1.0, 0.5, -2.0,
                       1.0, 0.5, -2.0,
                       1.0, 0.5, 50.0,
                      -1.0, 0.5, 50.0 };

    float n[3] = {  0.0, -1.0,  0.0};


     origin();
    glColor4f( 0.35, 0.35, 0.35, 1.0);

  glBegin(GL_QUADS);
  {
      //F0
      glNormal3fv(n);
      glVertex3fv(&v[3*0]);
      glVertex3fv(&v[3*1]);
      glVertex3fv(&v[3*2]);
      glVertex3fv(&v[3*3]);

  }glEnd();
}

void Plano::origin()const
{
    glDisable(GL_LIGHTING);
    glBegin(GL_LINES);
    glColor3f(1.0, 0, 0);
    glVertex3i(0, 0, 0);
    glVertex3i(1, 0, 0);

    glColor3f(0, 1.0, 0);
    glVertex3i(0, 0, 0);
    glVertex3i(0, 1, 0);

    glColor3f(0, 0, 1.0);
    glVertex3i(0, 0, 0);
    glVertex3i(0, 0, 1);
    glEnd();
    glEnable(GL_LIGHTING);
}
